<template>
	<div>
		<div id="backLogin" class="col-sm-3 col-xs-12 col-sm-offset-4" style="position: absolute; top: 25%;">
			<div class="panel panel-default">
				<div class="panel-heading">
					<div class="panel-title">
						<span>登陆通行证</span>
					</div>
				</div>
				<div class="panel-body" style="margin: 10px;">
				 	<div class="form-group">
					    <input v-model="name" style="background: url(../publicImg/input_username.png) 0px -5px no-repeat; text-indent:15px" type="text" class="form-control" placeholder="Name">
				  	</div>
				  	<div class="form-group">
					    <input v-model="password" style="background: url(../publicImg/input_password.png) 0px -5px no-repeat; text-indent:15px" type="password" class="form-control"  placeholder="Password">
				  	</div>
			  	  	<button class="btn btn-default col-sm-12 col-xs-12" v-on:click="login()">登陆</button>
		  	  	</div>
			</div>
		</div>
	</div>
</template>

<script>
	export default{
		data() {
	      	return {
		        name:"",
		        password:"",
	      	}
	    },
		mounted ($route) {
	 		this.$nextTick(()=>{
	 		})
	 	},
	 	methods:{
	  		login:function(){
	  			var _this = this;
				$.ajax({
					type:"POST",
					url:"http://www.qixiaocheng.cn/public/index.php/index/user/userLogin",
					data:{name:this.name,password:this.password},
					dataType:"json",
					success:function(data){
						if(!data){
							alert("密码错误！")
							$('#pass_word').focus();
						}else{
							_this.$router.push({name: 'manage'});
						}
					}
				});
	  		}
	  	},
	}
</script>

<style>
</style>